package cn.chochy.my.controller;

import cn.chochy.my.model.Blogs;
import cn.chochy.my.service.BlogsService;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author MLeo
 */

@Controller
public class IndexController {
    
    @Autowired
    private BlogsService blogsService;
    
    
    @RequestMapping(value = "/index")
    public ModelAndView loadIndex(ModelAndView view,Blogs blogs){
        List<String> list = new ArrayList<String>();
        list.add("MLeo");
        list.add("Chochy");
        view.addObject("name", "MLeo");
        view.addObject("list",list);
        view.setViewName("index");
        
        List<Blogs> blogsList = blogsService.queryList(blogs);
        System.out.println(blogsList.size());
        return view;
    }
    
    
}
